import { request } from '../utils/request'
export const getCartListAPI = () => {
  return request({
    method: 'GET',
    url: `/member/cart`,
  })
}
export const postCartAPI = (data) => {
  return request({
    method: 'POST',
    url: `/member/cart`,
    data,
  })
}

/**
 * 修改购物车商品
 * @param {string} id 购物车商品ID
 * @param {Object} data 更新的购物车商品数据
 * @returns {Promise} 返回更新购物车商品结果的Promise对象
 */
export const putCartAPI = (skuId, data) => {
  return request({
    method: 'PUT',
    url: `/member/cart/${skuId}`,
    data,
  })
}

/**
 * 删除购物车商品
 * @param {string} id 购物车商品ID
 * @returns {Promise} 返回删除购物车商品结果的Promise对象
 */
export const delCartAPI = (ids) => {
  return request({
    method: 'DELETE',
    url: `/member/cart/${id}`,
    ids,
  })
}
